<?php
namespace app\mp\admin;
use app\system\admin\Admin;
use app\common\model\Rejects as RejectsModel;

class Rejects extends Admin
{
    protected $hisiModel = 'Rejects';//模型名称[通用添加、修改专用]
    protected $hisiValidate = 'Rejects';
    protected $hisiAddScene = '';//添加数据验证场景名
    protected $hisiEditScene = '';//更新数据验证场景名

    public function initialize() {
    	parent::initialize();
    }

    public function index()
    {
    	if ($this->request->isAjax()) {
    		$where      = $data = [];
    		$page       = $this->request->param('page/d', 1);
    		$limit      = $this->request->param('limit/d', 20);
    		$keyword    = $this->request->param('keyword/s');

    		if ($keyword) {
    			$where[] = ['name', 'like', "%{$keyword}%"];
    		}

    		$order = 'id desc';
    		$data['data'] = RejectsModel::where($where)->page($page)->limit($limit)->order($order)->select();
    		$data['count'] = RejectsModel::where($where)->count('id');
    		$data['code'] = 0;
    		$data['msg'] = '';
    		return json($data);
    	}

    	$assign = [];
    	return $this->assign($assign)->fetch();
    }

}